/**
 * Copyright (C), 2019-2022, 宇信融汇
 * FileName: DeadListener
 * Author:   666
 * Date:     2022/4/22 8:18
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 666           修改时间           版本号              描述
 */
package com.mashibing.rabbitmq_boot;

import com.mashibing.rabbitmq_boot.config.DeadLetterConfig;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

import java.io.IOException;

/**
 * @Classname DeadListener
 * @Description TODO
 * @Date 2022/4/22 8:18
 * @Created by 666
 */
//@Component
public class DeadListener {
    @RabbitListener(queues = DeadLetterConfig.NORMAL_QUEUE)
    public void consume(String msg, Channel channel, Message message) throws IOException {
        System.out.println("接收到normal队列的消息：" + msg+"-----"+message.getMessageProperties().getDeliveryTag());
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
